package com.mymvpproject.base;

/**
 * Created by Administrator on 2018/3/26.
 */

public class DclSingleton {
    private static volatile DclSingleton instance = null;

    private DclSingleton() {
    }

    public static DclSingleton getInstance() {
        //避免不必要的同步
        if (instance == null) {
            //同步
            synchronized (DclSingleton.class) {
                //第一次调用的时候初始化
                if (instance == null) {
                    instance = new DclSingleton();
                }
            }
        }
        return instance;
    }
}
